//异步路由（需要权限的页面）
// let asyncRouterMap = [

//     {
//         path: '/',
//         component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
//         meta: { title: '自述文件' },
//         children: [
            // {
            //     path: '/index',
            //     component: () => import(/* webpackChunkName: "index" */ '../components/page/index.vue'),
            //     meta: { title: '系统首页'}
            // {
            //     path: '/icon',
            //     component: resolve => require(['../components/page/Icon.vue'], resolve),
            //     meta: { title: '自定义图标' }
            // },
            // {
            //     path: '/table',
            //     component: () => import(/* webpackChunkName: "table" */ '../components/page/BaseTable.vue'),
            //     meta: { title: '基础表格' }
            // },
            // {
            //     path: '/tabs',
            //     component: () => import(/* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'),
            //     meta: { title: 'tab选项卡' }
            // },
            // {
            //     path: '/form',
            //     component: () => import(/* webpackChunkName: "form" */ '../components/page/BaseForm.vue'),
            //     meta: { title: '基本表单' }
            // },
            // {
            //     // 富文本编辑器组件
            //     path: '/editor',
            //     component: () => import(/* webpackChunkName: "editor" */ '../components/page/VueEditor.vue'),
            //     meta: { title: '富文本编辑器' }
            // },
            // {
            //     // markdown组件
            //     path: '/markdown',
            //     component: () => import(/* webpackChunkName: "markdown" */ '../components/page/Markdown.vue'),
            //     meta: { title: 'markdown编辑器' }
            // },
            // {
            //     // 图片上传组件
            //     path: '/upload',
            //     component: () => import(/* webpackChunkName: "upload" */ '../components/page/Upload.vue'),
            //     meta: { title: '文件上传' }
            // },
            // {
            //     // vue-schart组件
            //     path: '/charts',
            //     component: () => import(/* webpackChunkName: "chart" */ '../components/page/BaseCharts.vue'),
            //     meta: { title: 'schart图表' }
            // },
            // {
            //     // 拖拽列表组件
            //     path: '/drag',
            //     component: () => import(/* webpackChunkName: "drag" */ '../components/page/DragList.vue'),
            //     meta: { title: '拖拽列表' }
            // },
            // {
            //     // 拖拽Dialog组件
            //     path: '/dialog',
            //     component: () => import(/* webpackChunkName: "dragdialog" */ '../components/page/DragDialog.vue'),
            //     meta: { title: '拖拽弹框' }
            // },
            // {
            //     // 国际化组件
            //     path: '/i18n',
            //     component: () => import(/* webpackChunkName: "i18n" */ '../components/page/I18n.vue'),
            //     meta: { title: '国际化' }
            // },
            // {
            //     // 权限页面
            //     path: '/permission',
            //     component: () => import(/* webpackChunkName: "permission" */ '../components/page/Permission.vue'),
            //     meta: { title: '权限测试', permission: true }
            // },
            // {
            //     path: '/403',
            //     component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
            //     meta: { title: '403' }
            // },
            // {
            //     path: '  ',
            //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/Donate.vue'),
            //     meta: { title: '支持作者' }
            // },
            // {
            //     path: '/ceshi1',
            //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/ceshi1.vue'),
            //     meta: { title: '权限一' }
            // },
            // {
            //     path: '/ceshi2',
            //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/ceshi2.vue'),
            //     meta: { title: '权限二' }
            // },
            // {
            //     path: '/404',
            //     component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
            //     meta: { title: '404' }
            // }
//         ]
//     },
//     {
//         path: '*',
//         redirect: '/404'
//     }
//   ]

let asyncRouterMap= (routers)=>{
    let data=[]
    routers.forEach( item => { 
        // console.log(item.page)
          data.push({
            path: item.path,
            component: resolve => require([`../components/page/${item.page}.vue`], resolve),
            meta: { title: item.title }
          })
    });
    let router_atrr = [

        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件' },
            children: [
                // {
                //     path: '/index',
                //     component: () => import(/* webpackChunkName: "index" */ '../components/page/index.vue'),
                //     meta: { title: '系统首页'}
                // {
                //     path: '/icon',
                //     component: resolve => require(['../components/page/Icon.vue'], resolve),
                //     meta: { title: '自定义图标' }
                // },
                // {
                //     path: '/table',
                //     component: () => import(/* webpackChunkName: "table" */ '../components/page/BaseTable.vue'),
                //     meta: { title: '基础表格' }
                // },
                // {
                //     path: '/tabs',
                //     component: () => import(/* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'),
                //     meta: { title: 'tab选项卡' }
                // },
                // {
                //     path: '/form',
                //     component: () => import(/* webpackChunkName: "form" */ '../components/page/BaseForm.vue'),
                //     meta: { title: '基本表单' }
                // },
                // {
                //     // 富文本编辑器组件
                //     path: '/editor',
                //     component: () => import(/* webpackChunkName: "editor" */ '../components/page/VueEditor.vue'),
                //     meta: { title: '富文本编辑器' }
                // },
                // {
                //     // markdown组件
                //     path: '/markdown',
                //     component: () => import(/* webpackChunkName: "markdown" */ '../components/page/Markdown.vue'),
                //     meta: { title: 'markdown编辑器' }
                // },
                // {
                //     // 图片上传组件
                //     path: '/upload',
                //     component: () => import(/* webpackChunkName: "upload" */ '../components/page/Upload.vue'),
                //     meta: { title: '文件上传' }
                // },
                // {
                //     // vue-schart组件
                //     path: '/charts',
                //     component: () => import(/* webpackChunkName: "chart" */ '../components/page/BaseCharts.vue'),
                //     meta: { title: 'schart图表' }
                // },
                // {
                //     // 拖拽列表组件
                //     path: '/drag',
                //     component: () => import(/* webpackChunkName: "drag" */ '../components/page/DragList.vue'),
                //     meta: { title: '拖拽列表' }
                // },
                // {
                //     // 拖拽Dialog组件
                //     path: '/dialog',
                //     component: () => import(/* webpackChunkName: "dragdialog" */ '../components/page/DragDialog.vue'),
                //     meta: { title: '拖拽弹框' }
                // },
                // {
                //     // 国际化组件
                //     path: '/i18n',
                //     component: () => import(/* webpackChunkName: "i18n" */ '../components/page/I18n.vue'),
                //     meta: { title: '国际化' }
                // },
                // {
                //     // 权限页面
                //     path: '/permission',
                //     component: () => import(/* webpackChunkName: "permission" */ '../components/page/Permission.vue'),
                //     meta: { title: '权限测试', permission: true }
                // },
                // {
                //     path: '/403',
                //     component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
                //     meta: { title: '403' }
                // },
                // {
                //     path: '/donate',
                //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/Donate.vue'),
                //     meta: { title: '支持作者' }
                // },
                // {
                //     path: '/ceshi1',
                //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/ceshi1.vue'),
                //     meta: { title: '权限一' }
                // },
                // {
                //     path: '/ceshi2',
                //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/ceshi2.vue'),
                //     meta: { title: '权限二' }
                // },
            ]
        }
      ]
      data.push(
        {
            path: '/404',
            component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
            meta: { title: '404' }
        }
      );
      router_atrr[0].children=data;
      router_atrr.push({
        path: '*',
        redirect: '/404'
    });
      console.log(router_atrr);
      return router_atrr;
  }  
// let routes_atrr = asyncRouterMap[0].children.filter(item => item.meta.auth)
let routes_atrr = asyncRouterMap

export default routes_atrr 
  
   